org 0h
clr P3.6 ; aktifkan perintah ini untuk emulator
call init_LCD
start: mov R1,#80h ; Lokasi Display RAM, Row=1 Col=1
call write_inst
mov R1,#'W'
call write_data
mov R1,#'e'
call write_data
mov R1,#'l'
call write_data
mov R1,#'c'
call write_data
mov R1,#'o'
call write_data
mov R1,#'m'
call write_data
mov R1,#'e'
call write_data
stop: sjmp stop
Init_lcd:
mov r1,#00000001b ;Display clear
call write_inst
mov r1,#00111000b ;Function set, Data 8 bit,2 line font 5x7
call write_inst
mov r1,#00001100b ;Display on, cursor off,cursor blink off
call write_inst
mov r1,#00000110b ;Entry mode, Set increment
call write_inst
ret
;
Write_inst:
clr P3.5 ; P3.5 = RS =0
mov P0,R1 ; copy R1 ke P0
setb P3.7 ; P3.7 =EN = 1
call delay ; call delay time
clr P3.7 ; P3.7 =EN = 0
ret
;
Write_data:
setb P3.5 ; P3.5 = RS =1
mov P0,R1 ; copy R1 ke P0
setb P3.7 ; P3.7 =EN = 1
call delay ; call delay time
clr p3.7 ; P3.7 =EN = 0
ret
delay: mov R0,#01h ; untuk emulator:
; perkecil delay ini dengan nilai 01h
delay1:mov R7,#0fh
djnz R7,$
djnz R0,delay1
ret
end